CachedSynchronizedOrderedDictionary

Ecng.Collections

Represents a thread-safe ordered dictionary with cached keys, values, and key-value pairs for improved performance.

Erbt von: SynchronizedOrderedDictionary<T, T>

Konstruktoren

CachedSynchronizedOrderedDictionary
public CachedSynchronizedOrderedDictionary()
cachedSynchronizedOrderedDictionary = CachedSynchronizedOrderedDictionary()

Initializes a new instance of the CachedSynchronizedOrderedDictionary class.

CachedSynchronizedOrderedDictionary
public CachedSynchronizedOrderedDictionary(IComparer<TKey> comparer)
cachedSynchronizedOrderedDictionary = CachedSynchronizedOrderedDictionary(comparer)

Initializes a new instance of the CachedSynchronizedOrderedDictionary class with the specified key comparer.

comparer
The comparer to use when comparing keys.
CachedSynchronizedOrderedDictionary
public CachedSynchronizedOrderedDictionary(Func<TKey, TKey, int> comparer)
cachedSynchronizedOrderedDictionary = CachedSynchronizedOrderedDictionary(comparer)

Initializes a new instance of the CachedSynchronizedOrderedDictionary class with the specified key comparison function.

comparer
The function to use when comparing keys.

Eigenschaften

CachedKeys
public TKey[] CachedKeys { get; }
value = cachedSynchronizedOrderedDictionary.CachedKeys

Gets an array of cached keys from the dictionary.

CachedPairs
public KeyValuePair<TKey, TValue>[] CachedPairs { get; }
value = cachedSynchronizedOrderedDictionary.CachedPairs

Gets an array of cached key-value pairs from the dictionary.

CachedValues
public TValue[] CachedValues { get; }
value = cachedSynchronizedOrderedDictionary.CachedValues

Gets an array of cached values from the dictionary.

Item
public override TValue Item { set; }
cachedSynchronizedOrderedDictionary.Item = value

Gets or sets the value associated with the specified key.

key
The key of the value to get or set.

Rückgabe: The value associated with the specified key.

Methoden

Add
public override void Add(TKey key, TValue value)
cachedSynchronizedOrderedDictionary.Add(key, value)

Adds the specified key and value to the dictionary.

key
The key of the element to add.
value
The value of the element to add.
Clear
public override void Clear()
cachedSynchronizedOrderedDictionary.Clear()

Removes all keys and values from the dictionary.

OnResetCache
protected virtual void OnResetCache(bool isKey)
cachedSynchronizedOrderedDictionary.OnResetCache(isKey)

Resets the cached keys, values, and key-value pairs when the dictionary is modified.

isKey
Indicates whether the cache reset is due to a key modification.
Remove
public override bool Remove(TKey key)
result = cachedSynchronizedOrderedDictionary.Remove(key)

Removes the value with the specified key from the dictionary.

key
The key of the element to remove.

Rückgabe: true if the element is successfully found and removed; otherwise, false.